home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Whiteline: delta
/
whiteline CD Series - delta.iso
/
systems
/
minix
/
bash1141.zoo
/
builtins
/
gem.def
Wrap
Text File
|
1994-07-26
|
2KB
|
88 lines
This file is gem.def, from which is created gem.c.
It implements the builtin "gem" in Bash.
$PRODUCES gem.c
$BUILTIN gem
$DEPENDS_ON atarist
$FUNCTION gem_builtin
$SHORT_DOC gem [command [arg ...]]
Runs COMMAND with ARGS with the mouse cursor turned on. Use this to
run commands which need the mouse.
$END
#if defined (HAVE_STRING_H)
# include <string.h>
#else /* !HAVE_STRING_H */
# include <strings.h>
#endif /* !HAVE_STRING_H */
#include "../shell.h"
#if defined (atarist)
#include <osbind.h>
#include <linea.h>
extern int subshell_environment;
static void restore_mouse ();
/* Run the commands mentioned in LIST with the mouse cursor turned on. */
int
gem_builtin (list)
WORD_LIST *list;
{
int result;
if (!list)
return (EXECUTION_SUCCESS);
begin_unwind_frame ("gem_builtin");
/* We don't want this to be reparsed (consider gem echo 'foo &'), so
just make a simple_command structure and call execute_command with it. */
{
COMMAND *command;
command = make_bare_simple_command ();
command->value.Simple->words = (WORD_LIST *)copy_word_list (list);
command->value.Simple->redirects = (REDIRECT *)NULL;
command->flags |= (CMD_NO_FUNCTIONS | CMD_INHIBIT_EXPANSION);
command->value.Simple->flags |= (CMD_NO_FUNCTIONS | CMD_INHIBIT_EXPANSION);
/* If we're in a subshell, see if we can get away without forking
again, since we've already forked to run this builtin. */
if (subshell_environment)
{
command->flags |= CMD_NO_FORK;
command->value.Simple->flags |= CMD_NO_FORK;
}
add_unwind_protect ((char *)dispose_command, command);
Bconout (2, 27);
Bconout (2, 'f');
(void) linea0 ();
{
short zero = 0;
INTIN = &zero;
(void) linea9 ();
}
add_unwind_protect ((Function *)restore_mouse, 0);
result = execute_command (command);
}
run_unwind_frame ("gem_builtin");
return (result);
}
/* Restore the mouse cursor. */
static void
restore_mouse ()
{
(void) lineaa ();
Bconout (2, 27);
Bconout (2, 'e');
}
#endif /* atarist */